package es.xpt.ysf.commons.report;

import java.util.Hashtable;
import java.util.StringTokenizer;

import es.xpt.ysf.commons.report.model.Report;

public class ReportFactory {
	public static Hashtable<String, Report> createReport(String reportURL) throws ReportException {

		StringTokenizer tokenizer = new StringTokenizer(reportURL, ",");
		Hashtable<String, Report> hash = new Hashtable<String, Report>();

		while (tokenizer.hasMoreTokens()) {
			String report = tokenizer.nextToken().trim();
			if (report.startsWith("xml://")) {
				ReportXML.load(report.substring(6), hash);
			} else
				throw new ReportException("No supported protocol");
		}
		return hash;
	}
}
